#define paginate(page, url)
#set(total=page.total)
#set(pageNo=page.pageNo)
#set(pageSize=page.pageSize)
#set(pages=page.pages)
<div  id="paginate" style="float:right; #if(pages<2)display:none;#end" ></div>
<script>
	layui.use('laypage', function(){
		var laypage = layui.laypage;
		laypage.render({
			elem: 'paginate', //注意，这里的 test1 是 ID，不用加 # 号
			count:#(total??0),
			limit:#(pageSize??10),
			curr: #(pageNo??1),
			jump: function(obj, first){
			    //得到了当前页，用于向服务端请求对应数据
			    var curr = obj.curr;
			    if (!first) {
			    	var urlSearch = window.location.search;
			    	// 判断当前搜索条件是否存在
			    	if (urlSearch) {
			    		// 将分页数放在最后一个参数位置以便于动态拼接查询条件
			    		var index = urlSearch.indexOf("&p=");
			    		if (index > -1){
			    			urlSearch = urlSearch.substring(0, index);
			    			window.location.href= "#(url)" + urlSearch + "&p=" + curr;
			    			return;
			    		}else if (urlSearch.indexOf("?p=") > -1){
				    		window.location.href= "#(url)?p=" + curr;
				    		return;
				    	}else {
				    		window.location.href= "#(url)" + urlSearch + "&p=" + curr;
				    		return;
				    	}
			    	}
			    	window.location.href= "#(url)?p=" + curr;
			    }
		  	}
		});
	});
</script>
#end